feat: expand Cue model with 8 missing fields (drift fix-up)#29
Merged
Conversation
Closes the Cue portion of cueapi-python #24's `model_drift` manifest. The SDK's Cue Pydantic model was silently dropping 8 fields the server returns (Pydantic default extra="ignore"); callers reading e.g. the ``catch_up`` policy or ``stats`` blob via the SDK got nothing. Fields added (all Optional with defaults so legacy responses still parse): - delivery: Optional[DeliveryConfig] — timeout_seconds, outcome_deadline_seconds - alerts: Optional[AlertConfig] — extra="allow" forward-compat - catch_up: Optional[str] — run_once_if_missed / skip_missed / replay_all - verification: Optional[VerificationConfig] — mode + required_assertions; extra="allow" - on_success_fire: Optional[str] — cue ID for 1:1 chaining (Gap 1) - require_payload_override: bool = False — hosted PR #590; default False matches server - required_payload_keys: Optional[List[str]] — hosted PR #590 - stats: Optional[Dict[str, Any]] — CueDetailResponse-only blob (7d success rate etc.) Three new nested models: - DeliveryConfig: typed schema for the 2-phase delivery config - AlertConfig: forward-compat (extra="allow") since alert kinds evolve server-side - VerificationConfig: typed `mode` + `required_assertions` plus extra="allow" for forward-compat on assertion kinds Tests: 11 new (30 → 41 unit tests). Coverage: - Old response (without new fields) still parses cleanly — pinning backward compat - Each new field round-trips correctly with a realistic payload - AlertConfig forward-compat: unknown server-side keys land in model_extra without raising - VerificationConfig forward-compat: same - Full-response roundtrip with every field set - CueList parses correctly with new fields in each row No breaking change for SDK callers — fields are additive, all Optional/defaulted, server's prior shape still parses. Bump warranted at next minor (0.3.0) for the new accessor surface. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
govindkavaturi-art
approved these changes
May 4, 2026
Member
govindkavaturi-art
left a comment
There was a problem hiding this comment.
extra="allow" + forward-compat config classes is the right shape for evolving server-side schemas. Drift fix-up that doesn't lock the model into today's surface. Approve.
mikemolinet
added a commit
that referenced
this pull request
May 11, 2026
…ive) Closes the remaining `model_drift` items in cueapi-python #24's parity manifest. Adds 4 new model files + 7 new exported classes covering the response shapes that resource methods currently return as raw dicts. **Additive only** — resource methods still return raw `dict` (no breaking change to return types). Callers opt into typed accessors via `Model.model_validate(dict)`. Promoting resource methods to return typed objects is a separate breaking-change PR and would warrant a major version bump. New files: - `cueapi/models/execution.py` — `Execution` + `ExecutionList` + `OutcomeDetail` (typed outcome inline). Covers all 13 fields the manifest flagged as missing on Execution: `payload` (PR #589), `outcome`, `outcome_state`, `triggered_by`, evidence_*, claimed_by_*, chain_*, last_heartbeat_at. - `cueapi/models/worker.py` — `Worker` + `WorkerList`. Captures `heartbeat_status` (online / stale / dead), `seconds_since_heartbeat`, `handlers` list. - `cueapi/models/agent.py` — `Agent` + `AgentList` (Phase 12.1.5 messaging primitive identity surface). Mirrors server's `AgentResponse`. `webhook_secret` field captures the one-time-on-create / one-time-on-regenerate contract. - `cueapi/models/message.py` — `Message` + `MessageList` + `FromAgentRef` (inline sender reference) + `StateTransitionResponse` (read / ack response shape). Notable design choices: - All new models use `extra="allow"` so server can grow response shapes without breaking SDK callers. Same pattern already in use on `AlertConfig` + `VerificationConfig` from #29. - `Message.from_agent` aliases the server's `from` field via `Field(alias="from")` — `from` is a reserved keyword in Python so the SDK exposes it as `from_agent` while still parsing server's `from` on the wire. `populate_by_name=True` lets callers use either name on construction. - All 11 new classes exported from `cueapi.__init__` for ergonomic access (`from cueapi import Agent, Message, ...`). Tests: 17 new (93 → 110 total). Coverage: - Minimal vs full responses parse cleanly - Forward-compat: unknown fields land in `model_extra` instead of raising - `from` → `from_agent` alias roundtrip - `webhook_secret` one-time-view shape on Agent - All new classes are exported from top-level + are BaseModel subclasses 🤖 Generated with [Claude Code](https://claude.com/claude-code)
mikemolinet
added a commit
that referenced
this pull request
May 11, 2026
…ive) (#31) Closes the remaining `model_drift` items in cueapi-python #24's parity manifest. Adds 4 new model files + 7 new exported classes covering the response shapes that resource methods currently return as raw dicts. **Additive only** — resource methods still return raw `dict` (no breaking change to return types). Callers opt into typed accessors via `Model.model_validate(dict)`. Promoting resource methods to return typed objects is a separate breaking-change PR and would warrant a major version bump. New files: - `cueapi/models/execution.py` — `Execution` + `ExecutionList` + `OutcomeDetail` (typed outcome inline). Covers all 13 fields the manifest flagged as missing on Execution: `payload` (PR #589), `outcome`, `outcome_state`, `triggered_by`, evidence_*, claimed_by_*, chain_*, last_heartbeat_at. - `cueapi/models/worker.py` — `Worker` + `WorkerList`. Captures `heartbeat_status` (online / stale / dead), `seconds_since_heartbeat`, `handlers` list. - `cueapi/models/agent.py` — `Agent` + `AgentList` (Phase 12.1.5 messaging primitive identity surface). Mirrors server's `AgentResponse`. `webhook_secret` field captures the one-time-on-create / one-time-on-regenerate contract. - `cueapi/models/message.py` — `Message` + `MessageList` + `FromAgentRef` (inline sender reference) + `StateTransitionResponse` (read / ack response shape). Notable design choices: - All new models use `extra="allow"` so server can grow response shapes without breaking SDK callers. Same pattern already in use on `AlertConfig` + `VerificationConfig` from #29. - `Message.from_agent` aliases the server's `from` field via `Field(alias="from")` — `from` is a reserved keyword in Python so the SDK exposes it as `from_agent` while still parsing server's `from` on the wire. `populate_by_name=True` lets callers use either name on construction. - All 11 new classes exported from `cueapi.__init__` for ergonomic access (`from cueapi import Agent, Message, ...`). Tests: 17 new (93 → 110 total). Coverage: - Minimal vs full responses parse cleanly - Forward-compat: unknown fields land in `model_extra` instead of raising - `from` → `from_agent` alias roundtrip - `webhook_secret` one-time-view shape on Agent - All new classes are exported from top-level + are BaseModel subclasses 🤖 Generated with [Claude Code](https://claude.com/claude-code)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes the Cue portion of cueapi-python #24's
model_driftmanifest. The SDK'sCuePydantic model was silently dropping 8 fields the server returns (Pydantic defaultextra=\"ignore\"); callers reading e.g. thecatch_uppolicy orstatsblob via the SDK got nothing.Fields added
All Optional with defaults so legacy server responses still parse cleanly:
deliveryOptional[DeliveryConfig]alertsOptional[AlertConfig]catch_upOptional[str]verificationOptional[VerificationConfig]on_success_fireOptional[str]require_payload_overridebool = Falserequired_payload_keysOptional[List[str]]statsOptional[Dict[str, Any]]Three new nested models
DeliveryConfig— typed schema for 2-phase deliveryAlertConfig—extra=\"allow\"forward-compat (alert kinds evolve server-side)VerificationConfig— typedmode+required_assertionsplusextra=\"allow\"for forward-compat on assertion kindsForward-compat note
AlertConfigandVerificationConfiguseextra=\"allow\"so the SDK doesn't break when the server grows the object. Pinned by tests:test_alerts_config_forward_compat— unknown server-side keys land inmodel_extrawithout raisingtest_verification_config_forward_compat— sameTests
11 new (30 → 41 unit tests passing). Coverage:
AlertConfigandVerificationConfigforward-compatCueListparses correctly with new fields in each rowBackward compat
No breaking change for SDK callers:
test_old_response_still_parses)Worth a minor version bump (0.3.0) at next release for the new accessor surface, but no API removals.
Companion PRs from this session
mark_verifiedbug fix +replay()WorkersResource+UsageResourceAgentsResourceMessagesResourceAfter this lands, the remaining
model_driftitems are:🤖 Generated with Claude Code